package com.ymatou.iapi.quickturnover.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.quickturnover.parameter.InitSellerAdvanceReqBean;
import com.ymatou.iapi.quickturnover.service.InitSellerAdvanceReqCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.utils.EnvSetup;
/**
*对首次开通服务的商家60天之内数据初始化接口
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_InitSellerAdvanceReq{
	private static InitSellerAdvanceReqBean initselleradvancereqBean;
	private static InitSellerAdvanceReqCall initselleradvancereqCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("对首次开通服务的商家60天之内数据初始化接口");
	}

	@Before
	public void caseUp() {
		initselleradvancereqBean=new InitSellerAdvanceReqBean();
		initselleradvancereqCall=new InitSellerAdvanceReqCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(initselleradvancereqCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_InitSellerAdvanceReq_001() {
		Logger.start(true,"对首次开通服务的商家60天之内数据初始化");
		try {
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			initselleradvancereqBean.setSellerId(sellerId);
			initselleradvancereqCall.setData(initselleradvancereqBean);
			initselleradvancereqCall.callService();			
			Logger.verifyEquals("ok", initselleradvancereqCall.getReturnData(), "验证接口返回ok");		

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_InitSellerAdvanceReq_002() {
		Logger.start(true,"seller id 为null");
		try {
			//initselleradvancereqBean.setSellerId(sellerId);
			initselleradvancereqCall.setData(initselleradvancereqBean);
			initselleradvancereqCall.callService();			
			Logger.verifyEquals("fail", initselleradvancereqCall.getReturnData(), "验证接口返回ok");		

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}